Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: SimpleReplacement panic on multiports #1191

Merged
merged 4 commits into from
Jun 17, 2024
Merged

fix: SimpleReplacement panic on multiports #1191

merged 4 commits into from
Jun 17, 2024

Conversation

aborgna-q
Copy link
Collaborator

Fixes #1190.

@aborgna-q aborgna-q requested a review from a team as a code owner June 12, 2024 16:46
@aborgna-q aborgna-q requested a review from ss2165 June 12, 2024 16:46
@aborgna-q aborgna-q changed the title Fix: SimpleReplacement panic on multiports fix: SimpleReplacement panic on multiports Jun 12, 2024
Copy link

codecov bot commented Jun 12, 2024

Codecov Report

Attention: Patch coverage is 83.33333% with 6 lines in your changes missing coverage. Please review.

Project coverage is 86.57%. Comparing base (ea5213d) to head (818e067).
Report is 3 commits behind head on main.

Current head 818e067 differs from pull request most recent head 9071f9c

Please upload reports for the commit 9071f9c to get more accurate results.

Files Patch % Lines
hugr-core/src/hugr/rewrite/simple_replace.rs 83.33% 1 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1191      +/-   ##
==========================================
- Coverage   86.57%   86.57%   -0.01%     
==========================================
  Files          94       94              
  Lines       17659    17690      +31     
  Branches    16797    16828      +31     
==========================================
+ Hits        15289    15315      +26     
- Misses       1600     1601       +1     
- Partials      770      774       +4     
Flag Coverage Δ
rust 86.43% <83.33%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@ss2165 ss2165 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 thanks

@aborgna-q aborgna-q enabled auto-merge June 17, 2024 09:21
@aborgna-q aborgna-q added this pull request to the merge queue Jun 17, 2024
Merged via the queue into main with commit 102d661 Jun 17, 2024
18 checks passed
@aborgna-q aborgna-q deleted the ab/simple-bug branch June 17, 2024 09:24
@hugrbot hugrbot mentioned this pull request Jun 17, 2024
This was referenced Jun 28, 2024
github-merge-queue bot pushed a commit that referenced this pull request Jul 1, 2024
## 🤖 New release
* `hugr`: 0.5.1 -> 0.6.0
* `hugr-core`: 0.2.0 -> 0.3.0
* `hugr-passes`: 0.2.0 -> 0.3.0
* `hugr-cli`: 0.1.1 -> 0.1.2

<details><summary><i><b>Changelog</b></i></summary><p>

## `hugr`
<blockquote>

## 0.6.0 (2024-06-28)

### Bug Fixes

- SimpleReplacement panic on multiports
([#1191](#1191))
- Add some validation for const nodes
([#1222](#1222))
- Cfg not validating entry/exit types
([#1229](#1229))
- `extract_hugr` not removing root node ports
([#1239](#1239))

### Documentation

- Fix documentation of `ValidationError::ConstTypeError`
([#1227](#1227))

### Features

- CircuitBuilder::add_constant
([#1168](#1168))
- [**breaking**] Make the rewrite errors more useful
([#1174](#1174))
- [**breaking**] Validate Extensions using hierarchy, ignore
input_extensions, RIP inference
([#1142](#1142))
- [**breaking**] Infer extension deltas for Case, Cfg, Conditional,
DataflowBlock, Dfg, TailLoop
([#1195](#1195))
- Helper functions for requesting inference, use with builder in tests
([#1219](#1219))

### Refactor

- [**breaking**] FunctionBuilder takes impl Into<PolyFuncType>
([#1220](#1220))
- [**breaking**] Remove NodeType and input_extensions
([#1183](#1183))
</blockquote>

## `hugr-core`
<blockquote>

## 0.3.0 (2024-06-28)

### Bug Fixes

- SimpleReplacement panic on multiports
([#1191](#1191))
- Add some validation for const nodes
([#1222](#1222))
- Cfg not validating entry/exit types
([#1229](#1229))
- `extract_hugr` not removing root node ports
([#1239](#1239))

### Documentation

- Fix documentation of `ValidationError::ConstTypeError`
([#1227](#1227))

### Features

- CircuitBuilder::add_constant
([#1168](#1168))
- [**breaking**] Make the rewrite errors more useful
([#1174](#1174))
- [**breaking**] Validate Extensions using hierarchy, ignore
input_extensions, RIP inference
([#1142](#1142))
- [**breaking**] Infer extension deltas for Case, Cfg, Conditional,
DataflowBlock, Dfg, TailLoop
([#1195](#1195))
- Helper functions for requesting inference, use with builder in tests
([#1219](#1219))

### Refactor

- [**breaking**] Remove NodeType and input_extensions
([#1183](#1183))
- [**breaking**] FunctionBuilder takes impl Into<PolyFuncType>
([#1220](#1220))
</blockquote>

## `hugr-passes`
<blockquote>

## 0.3.0 (2024-06-28)

### Features

- [**breaking**] Validate Extensions using hierarchy, ignore
input_extensions, RIP inference
([#1142](#1142))
- Helper functions for requesting inference, use with builder in tests
([#1219](#1219))

</blockquote>

## `hugr-cli`
<blockquote>

## 0.1.1 (2024-06-07)

### Features

- Reexport `clap::Parser` and `clap_verbosity_flag::Level` from hugr_cli
([#1146](#1146))

### Refactor

- Move binary to hugr-cli
([#1134](#1134))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/MarcoIeni/release-plz/).

---------

Co-authored-by: Douglas Wilson <douglas.wilson@quantinuum.com>
@hugrbot hugrbot mentioned this pull request Jul 1, 2024
github-merge-queue bot pushed a commit to CQCL/tket2 that referenced this pull request Jul 11, 2024
This was already implemented, but blocked by a bug in hugr
(CQCL/hugr#1191).

drive-by: Added a test case for #416, the last missing case for tuple
unpacking

---------

Co-authored-by: Douglas Wilson <141026920+doug-q@users.noreply.github.com>
github-merge-queue bot pushed a commit that referenced this pull request Jul 19, 2024
Fixes #1323

This fix generalises the one from #1191.
SimpleReplace was too eager in disconnecting/connecting edges to the
replacement graph, and that caused issues when querying the neighbours
of multiports.

This gets resolved by delaying all new connections to the replacement
until after we have computed all of them.
We don't need to do explicit disconnections to the replaced subgraph,
since the nodes get removed anyway.

---------

Co-authored-by: Douglas Wilson <141026920+doug-q@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SimpleRewrite panics on multiports
2 participants